Socket
Socket
Sign inDemoInstall

@sec-ant/readable-stream

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sec-ant/readable-stream

A Simple Yet Spec-Compliant Asynchronous Iteration Polyfill for ReadableStreams from Web Streams API


Version published
Maintainers
1
Created
Source

@sec-ant/readable-stream

A Simple Yet Spec-Compliant Asynchronous Iteration Polyfill for ReadableStreams from Web Streams API

Features

Async Iteration of a ReadableStream

With this polyfill, you'll be able to consume a ReadableStream as an AsyncIterable.

Construction of a ReadableStream from an AsyncIterable or an Iterable

You can use the function fromIterable in this package to construct a ReadableStream from an AsyncIterable or an Iterable. This mimics the static method ReadableStream.from.

This package passes all the aforementioned tests.

Install

npm i @sec-ant/readable-stream

Usage

This package can be used as a side effect if you only need the async iteration support:

import "@sec-ant/readable-stream";

You can also import the fromIterable function which enables you to construct a ReadableStream from an Iterable or an AsyncIterable:

import { fromIterable } from "@sec-ant/readable-stream";

With the help of this package, you can "tee" an AsyncIterable like this:

import { fromIterable } from "@sec-ant/readable-stream";

async function* createAsyncIterable() {
  yield "how";
  yield "are";
  yield "you";
}

const asyncIterable = createAsyncIterable();

const [asyncIterable1, asyncIterable2] = fromIterable(asyncIterable).tee();

License

MIT

Keywords

FAQs

Package last updated on 20 Jul 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc